{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import csv\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "outputpath='valuation.csv'\n",
    "df_empty = pd.DataFrame()\n",
    "for i in range(14, 21):\n",
    "    df = get_fundamentals(query(valuation), statDate='20'+str(i)+'q2')\n",
    "    df_empty=df_empty.append(df)\n",
    "df_empty.to_csv(outputpath)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "outputpath='balance.csv'\n",
    "df_empty = pd.DataFrame()\n",
    "for i in range(14, 21):\n",
    "    df = get_fundamentals(query(balance), statDate='20'+str(i)+'q2')\n",
    "    df_empty=df_empty.append(df)\n",
    "df_empty.to_csv(outputpath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "outputpath='income.csv'\n",
    "df_empty = pd.DataFrame()\n",
    "for i in range(14, 21):\n",
    "    df = get_fundamentals(query(income), statDate='20'+str(i)+'q2')\n",
    "    df_empty=df_empty.append(df)\n",
    "df_empty.to_csv(outputpath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "outputpath='indicator.csv'\n",
    "df_empty = pd.DataFrame()\n",
    "for i in range(14, 21):\n",
    "    df = get_fundamentals(query(indicator), statDate='20'+str(i)+'q2')\n",
    "    df_empty=df_empty.append(df)\n",
    "df_empty.to_csv(outputpath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "outputpath='bank_indicator.csv'\n",
    "df_empty = pd.DataFrame()\n",
    "for i in range(14, 21):\n",
    "    df = get_fundamentals(query(bank_indicator), statDate='20'+str(i)+'q2')\n",
    "    df_empty=df_empty.append(df)\n",
    "df_empty.to_csv(outputpath)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.7"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "MarkDown菜单",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
